package com.faiz.picturebed.registry.beanregistry;

import com.faiz.picturebed.common.PictureType;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

public abstract class AbstractBeanRegistry implements IAnnotationRegistry{

    protected final Map<PictureType, Object> registryBeanMap = new ConcurrentHashMap<>();

    protected final Set<PictureType> registeredPictureTypes = registryBeanMap.keySet();

    @Override
    public void register(PictureType pictureType, Object bean) {
        this.registryBeanMap.put(pictureType, bean);
    }

    @Override
    public <T> T getRegistrant(PictureType pictureType) {
        return (T) this.registryBeanMap.get(pictureType);
    }

    public abstract void printRegisteredBeans();
}
